<% if session[:user_id] %>	
	<h1>Tarjetas gráficas disponibles</h1>

	<table border=1>
		<tr>
		  <th>Título</th>
		  <th>Descripcion</th>
		  <th>Memoria (MB)</th>
		  <th>Tipo</th>
		  <th>Velocidad de memoria (MHz)</th>
		  <th>Velocidad del procesador (MHz)</th>
		  <th>Consumo (W)</th>
		  <th>Ancho de banda</th>
		  <th>PCI</th>
		  <th>URL</th>
		  <th>Precio</th>
		  <th></th>
		  <th></th>
		  <th></th>
		</tr>

	<% @graphics.each do |graphic| %>
		<tr>
		  <td><%= graphic.title %></td>
		  <td><%= graphic.description %></td>
    <td class="center"><%= graphic.memcapacity %></td>
    <td class="center"><%= graphic.graphictype %></td>
    <td class="center"><%= graphic.memspeed %></td>
    <td class="center"><%= graphic.procspeed %></td>
    <td class="center"><%= graphic.energycom %></td>
    <td class="center"><%= graphic.bandwidth %></td>
    <td class="center"><%= graphic.pcitype %></td>
		  <td><%= link_to graphic.product_url, graphic.product_url, :target => '_blank' %></td>
    <td class="center"><%= graphic.price %></td>
		  <td><%= link_to 'Mostrar', graphic %></td>
		  <td><%= link_to 'Editar', edit_graphic_path(graphic) %></td>
		  <td><%= link_to 'Eliminar', graphic, method: :delete, data: { confirm: '¿Está seguro?' } %></td>
		</tr>
	<% end %>
	</table>

	<br />

	<%= link_to 'Nueva tarjeta gráfica', new_graphic_path %>
<% else %>
	<% if notice %>
	<p id="notice"><%= notice %></p>
	<% end %>

	<h1>Catalogo de tarjetas graficas</h1>

	<% @graphics.each do |graphic| %>
		<div class="entry">
			<h3><%= graphic.title %></h3>
			<%= sanitize(graphic.description) %>
			<div class="price_line">
				<span class="price"><%= number_to_currency(graphic.price) %></span>
				<% prod = Product.find(:first, :conditions => ["heir_id = ? and heir_type = ?",graphic.id, 'Graphic']) %>
				<%= button_to 'Añadir a la configuracion', line_products_path(product_id: prod.id) %>
			</div>
		</div>
	<% end %>
<% end %>
